home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 004 / _cliguard / !CLIGuard / AppSource (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-09-24  |  69KB  |  2,989 lines

  1.  CLI Guardian
  2.  To protect you from the CLI
  3.  (C) Sam Kington 1994
  4.  See Messages file for version (this line won
  5. t be in the crunched code anyway)
  6.  26: 
  7. 0,1);
  8. $; " at line ";
  9. alias$="<CLIGuard$Dir>"
  10. taskname$="CLI Guardian"
  11. WimpInit=
  12. BufferLow=
  13. error : 
  14. msgtrans
  15. cliguardvars
  16. setup
  17. readmodules
  18. pollloop
  19. finish
  20. pollloop
  21. poll(stdmask)
  22. setup
  23. assemble
  24. icons
  25. menuinit
  26. messageinit
  27. startwimp
  28. loadtemplates(alias$+".Templates")
  29. loadchoices
  30. refreshchoices
  31. writeicon(win_info, icon_version, version$)
  32. buildmenus
  33. getmodevars
  34. :"baricon%=
  35. iconbar("!cliguard")
  36.  loop
  37.  block% 1024, string 256
  38. v    On=-1
  39. Off=-2
  40. doneiconbar=
  41. _MinMem=4096
  42. stdmask= %11100000110001
  43. nullmask=%11100000110000
  44. idlemask=-1
  45. idlegap=10
  46. currenthandle%=-1
  47. poll(pollmask)
  48.  time
  49.  EndOfMemory=HIMEM
  50.  pollmask<>idlemask 
  51.  "Wimp_Poll", pollmask, block% 
  52.  reason%
  53.  '   
  54.  "OS_ReadMonotonicTime" 
  55.  time
  56. *C   
  57.  "Wimp_PollIdle", nullmask, block%, time+idlegap 
  58.  reason%
  59.  reason% 
  60. redraw
  61. close
  62. fJ   
  63. checkmouse(!block%, block%!4, block%!8, block%!12, block%!16)
  64. dragged
  65. checkkeys
  66.       
  67. menuselect
  68. 9      
  69.  currenthandle%=Iconmenu% 
  70.  menuy%=menuheight%
  71.       
  72.  (but% 
  73.  1) =1 
  74. :         
  75.  currenthandle%=Mainmenu% 
  76. buildmodulemenu
  77. 8         
  78. reopenmenu(currenthandle%, menux%, menuy%)
  79.       
  80.          currenthandle%=0
  81.       
  82.  17, 18: 
  83. message(reason%)
  84. <_MinMem 
  85. moremem
  86. moremem
  87.  slotsize, free, add
  88.  "Wimp_SlotSize", -1, -1 
  89.  slotsize,, free
  90. add=free
  91.  add>16*1024 
  92.  add=16*1024
  93. pollloop
  94. assemble
  95.  pass, sp, link, pc
  96.  code 600
  97.     sp=13
  98. link=14
  99.     pc=15
  100. WrchV=3
  101. ErrorV=1
  102. RdchV=4
  103. ChangeEnvironmentV=&1E
  104.  pass=0 
  105. P%=code
  106. [OPT pass
  107.  ** String read **
  108. .stringread
  109. !STMFD    (sp)!, {r0-r3, link}
  110.  enter with pointer to original in r0 and output buffer in r1
  111.  r2 holds counter, r3 actual value
  112. MOV      r2, #0
  113. .start
  114. <'LDRB     r3, [r0, r2]   ; load byte
  115. F+CMP      r3, #0         ; is it a null?
  116. Q    r3, #13        ; if it is, replace by a <CR>
  117. Z?STRB     r3, [r1, r2]   ; store it back whatever the result
  118. d?ADDNE    r2, r2, #1     ; if it's OK, increment the pointer
  119. n9BNE      start          ; and start again - else exit
  120. LDMIA    (sp)!, {r0-r3, pc}
  121.  ** Intercept vector **
  122. .claim
  123.  STMFD   (sp)!, {r0-r2, link}
  124. 3BL      setupregs       ; Setup for WrchV claim
  125. SWI     "OS_Claim"
  126. DBL      errorregs       ; Setup for ErrorV claim (release WrchV)
  127. SWI     "OS_Claim"
  128. FMOV     r0, #RdchV      ; Same claim for RdchV, ChangeEnvironmentV
  129. SWI     "OS_Claim"
  130. #MOV     r0, #ChangeEnvironmentV
  131. SWI     "OS_Claim"
  132. MOV     r0, #0
  133. STR     r0, counter
  134. MOV     r0, #1
  135. STR     r0, bufferclaimed
  136. LDMIA   (sp)!, {r0-r2, pc}
  137. .setupregs
  138. @*MOV     r0, #WrchV      ; WrchV vector
  139. J0ADR     r1, intercept   ; pointer to routine
  140. TDLDR     r2, bufpointer  ; point to buffer, will be passed in R12
  141. MOV     pc, link
  142. .errorregs
  143. MOV     r0, #ErrorV
  144. ADR     r1, release
  145. MOV     r2, #0
  146. MOV     pc, link
  147. .counter
  148. EQUD    0
  149. .bufpointer
  150. -EQUD    0               ; point to buffer
  151. .bufmaxsize
  152. 2EQUD    0               ; point to buffer size
  153. .bufferclaimed
  154. @EQUD    0               ; 0 when not claimed, 1 when claimed
  155. .release
  156.  STMFD   (sp)!, {r0-r2, link}
  157. LDR     r0, bufferclaimed
  158. CMP     r0, #1
  159. BNE     quitrelease
  160. :-BL      setupregs       ; Setup for WrchV
  161. SWI     "OS_Release"
  162. N.BL      errorregs       ; Setup for ErrorV
  163. SWI     "OS_Release"
  164. b@MOV     r0, #RdchV      ; Same for RdchV, ChangeEnvironmentV
  165. SWI     "OS_Release"
  166. v#MOV     r0, #ChangeEnvironmentV
  167. SWI     "OS_Release"
  168. .quitrelease
  169. SWI     &100+26
  170. MOV     r0, #0
  171. STR     r0, bufferclaimed
  172. LDMIA   (sp)!, {r0-r2, pc}
  173. .intercept
  174. STMFD   (sp)!, {r9-r12}
  175. /LDR     r11, counter    ; Get counter value
  176. .LDR     r10, bufmaxsize ; Get maximum size
  177. 0CMP     r11, r10        ; Check for overflow
  178. BGE     quitintercept
  179. ;CMP     r0, #32         ; Is this a writable character?
  180. -BGE     writebuffer     ; If so, write it
  181. ,CMP     r0, #9          ; Is this a tab?
  182. Q   r0, #32         ; If so, replace it by a space
  183. *+BEQ     writebuffer     ; and write it.
  184. 44CMP     r0, #13         ; Is this a return then?
  185. >*BNE     quitintercept   ; If not, quit
  186. HBCMP     r11, #0         ; Check if this is the first character
  187. REBEQ     quitintercept   ; If so, quit to avoid a blank first line
  188. .writebuffer
  189. fMSTRB    r0, [r12, r11]  ; We're OK, so store in buffer, offset by counter
  190. p/ADD     r11, r11, #1    ; increment counter
  191. z)STR     r11, counter    ; put it back
  192. .quitintercept
  193. VLDMIA   (sp)!, {r9-r12, pc}       ; Pass control back to whoever called the vector
  194.  ** Parse **
  195.  parse enters with pointer to text in r0, lines in r1, info in r2, last char in r3
  196.  stores numlines in r2+0, width in r2+4
  197.  r4 number of chars, r5 number of lines, r6 character, r7 max width
  198. .parse
  199.  STMFD   (sp)!, {r0-r7, link}
  200. $MOV     r4, #0          ; char 0
  201. $MOV     r5, #0          ; line 0
  202. *MOV     r7, #0          ; no width yet
  203. BSTR     r0, [r1]        ; Store pointer to first line in lines
  204. .parseloop
  205.     $'LDRB    r6, [r0, r4]    ; load char
  206.     .-CMP     r6, #13         ; is it a return?
  207.     8GADDNE   r4, r4, #1      ; if not, increment number of chars in line
  208.     B+BNE     parseloop       ; and loop back
  209. .testwidth
  210.     V0CMP     r4, r7          ; compare with width
  211.     `LMOVGT   r7, r4          ; if it's greater, replace the old maximum width
  212. .testend
  213.     t7ADD     r4, r4, #1      ; increment number of chars
  214.     ~/ADD     r0, r0, r4      ; add it to pointer
  215. *MOV     r4, #0          ; zero pointer
  216. 4CMP     r0, r3          ; is this the last char?
  217. UADDLT   r5, r5, #1      ; if not, this is a new line, so add 1 to number of lines
  218. 9ADDLT   r1, r1, #4      ; increment line pointer by 4
  219. @STRLT   r0, [r1]        ; store pointer to beginning of char
  220. &BLT     parseloop       ; and loop
  221. /.exit                   ; otherwise tidy up
  222. ;STR     r5, [r2]        ; store number of lines in r2+0
  223. 9STR     r7, [r2, #4]    ; store maximum width in r2+4
  224. LDMIA   (sp)!, {r0-r7, pc}
  225. .caseless
  226. !STMFD   (sp)!, {r0, r1, link}
  227. .start
  228. LDRB    r1, [r0]
  229. CMP     r1, #13
  230. BEQ     quit
  231. CMP     r1, #65
  232. BLT     reloop
  233. CMP     r1, #90
  234. ADDLE   r1, r1, #32
  235. STRLEB  r1, [r0]
  236. .reloop
  237. ADD     r0, r0, #1
  238. B       start
  239.     .quit
  240. LDMIA   (sp)!, {r0, r1, pc}
  241. cliguardvars
  242.  loop, varbuf
  243. bufferclaimed=-1
  244.  Misc
  245. version$=
  246. mess("Ver")
  247. tab$=
  248.  varbuf 256
  249.  "OS_ReadVarVal", "CLIGuard$Dir", varbuf, 256, 0, 3 
  250.  ,,numread
  251. varbuf?numread=13
  252. r"StartCLIGuard$="%Run "+$varbuf
  253.  illegal$(255)
  254. illegal$()="wimpslot", "copy", "wipe", "rename", "append", "build", "breakclr", "continue", "backup", "format", "run", "\", "checkmap", "debug", "quit", "basic", "map", "delete"
  255.  textcol(15)
  256. <textcol()=7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 7, 7
  257.  Buffers
  258. numbuffers=16
  259. _Start=0
  260. _Info=1
  261. _Flags=2
  262. _Help=3
  263. _End=4
  264. _Handle=5
  265. buffernums=5
  266.  textbuffer(numbuffers, buffernums)
  267. _TextOffset=64
  268. bufferwindows=0
  269. BufferLow=
  270. BufferHigh=
  271.  loop=1 
  272.  numbuffers : textbuffer(loop, _Start)=-1 : 
  273.  helpcode$(4)
  274.  loop=1 
  275. X,   helpcode$(loop)=
  276. mess("Help"+
  277. (loop))
  278. maxhelplines=64
  279.  helpbuffer maxhelplines*4, helpflags maxhelplines
  280. arrow=&203E3D3D : 
  281.  "==> "
  282. *bufferstate=-1 : 
  283.  no buffers modified
  284.  Window
  285. winopen_modules=
  286. $modwinwidth=1000 : 
  287.  dummy value
  288. /oldmodwidth=42   : 
  289.  deliberately different
  290. Short=1
  291. Long=2
  292. oldshowname=Short
  293. oldshowver=
  294. oldshowspec=
  295. oldshowstatus=
  296. fontsize=12
  297. texthandle=-1
  298. greyhandle=-1
  299. headhandle=-1
  300. Text=1
  301. Greyed=2
  302. Heading=3
  303. fonttype=-1
  304.  Modules
  305. maxmodules=256
  306. modulestep=10
  307. moddim=32
  308. helpdim=90
  309. namedim=32
  310. verdim=24
  311. specdim=32
  312. numstatus=6
  313. moduleop=
  314.  mod$(maxmodules), help$(maxmodules), status maxmodules
  315.  name$(maxmodules), ver$(maxmodules), spec$(maxmodules)
  316.  modstatus$(numstatus)
  317.  modbase(maxmodules)
  318.  alphasort maxmodules, sequencesort maxmodules, versionsort maxmodules
  319. =modlen=0 : namelen=0 : verlen=0 : speclen=0 : statuslen=0
  320. prefsort=sequencesort
  321. oldprefsort=sequencesort
  322. readmodules=
  323.  loop=0 
  324.  numstatus
  325. $-   modstatus$(loop)=
  326. mess("Stat"+
  327. (loop))
  328.  Choices
  329. _IconMod=0
  330. _IconHelp=1
  331. _IconComm=2
  332. _WinHelp=0
  333. _WinComm=1
  334. _WinSave=2
  335. _WinClose=3
  336. _Iconbar=0
  337. _Window=1
  338. _ModWin=2
  339. _Select=4
  340. _Adjust=1
  341. _Shift=8
  342. _Ctrl=16
  343. _Alt=32
  344.  mouseclick(1,3), tempmouseclick(1,3)
  345. defaultchoices
  346. sortmenunumber(sort)
  347.  sort 
  348. <&   
  349.  alphasort : num=menu_sortname
  350. F(   
  351.  sequencesort : num=menu_sortnum
  352. P'   
  353.  versionsort : num=menu_sortver
  354. readmodules
  355.  maxlen, inspos, lastinspos, stop, loop, maxwinheight, oldnummods, changed
  356.  ** Initial stuff **
  357.  "Hourglass_On"
  358. nummodules=0
  359. inspos=1
  360. lastinspos=1
  361. tab$=
  362. =modlen=0 : namelen=0 : verlen=0 : speclen=0 : statuslen=0
  363. moduleop=
  364.  loop=1 
  365.  maxmodules : status?loop=0 : 
  366.  loop=1 
  367.    alphasort?loop=0
  368.    sequencesort?loop=0
  369. oldshowname=showname
  370. showname=Short
  371. showver=
  372. showspec=
  373. showstatus=
  374. prefsort=sequencesort
  375.  loop=menu_sortname 
  376.  menu_showspec
  377. faintmenu(Displaymenu%, loop, 
  378. tickmenu(Displaymenu%, loop, 
  379. faintmenu(Displaymenu%, menu_shortname, 
  380. tickmenu(Displaymenu%, menu_shortname, 
  381.  loop=menu_modinfo 
  382.  menu_modromver
  383. faintmenu(Modulemenu%, loop, 
  384. !block%=-2
  385.  "Wimp_GetWindowState",,block%
  386. topiconbar=block%!16
  387. 'winheight=MaxYCoord-topiconbar-2450
  388.  winopen_modules 
  389.    !block%=win_modules
  390. 0'   
  391.  "Wimp_GetWindowState",,block%
  392.    block%!24=0
  393. D#   
  394.  "Wimp_OpenWindow",,block%
  395.  ** Read modules **
  396. rammodules
  397. recalctabs
  398. moduleextent
  399.  winopen_modules 
  400. forceredraw(win_modules)
  401. readmodules=
  402. faintmenu(Displaymenu%, menu_sortnum, 
  403. tickmenu(Displaymenu%, menu_sortnum, 
  404. faintmenu(Modulemenu%, menu_modinfo, 
  405. faintmenu(Modulemenu%, menu_modhelp, 
  406.  currenthandle%=Mainmenu% 
  407.  Fontmenu%=-1 
  408. reopenmenu(currenthandle%, menux%, menuy%)
  409.  ** Find ROM modules **
  410. oldnummods=nummodules
  411. rommodules
  412.  loop=menu_moddelete 
  413.  menu_modromver
  414. 4'   
  415. faintmenu(Modulemenu%, loop, 
  416. moduleop=
  417. faintmenu(Displaymenu%, menu_showstatus, 
  418.  oldshowstatus 
  419.    showstatus=
  420. p2   
  421. tickmenu(Displaymenu%, menu_showstatus, 
  422. recalctabs
  423. moduleextent
  424. forceredraw(win_modules)
  425.  currenthandle%=Mainmenu% 
  426.  Fontmenu%=-1 
  427. reopenmenu(currenthandle%, menux%, menuy%)
  428.  nummodules<>oldnummods 
  429. moduleextent
  430.  ** Build alphabetical sort order **
  431. buildsort(alphasort, mod$())
  432. faintmenu(Displaymenu%, menu_sortname, 
  433.  oldprefsort=alphasort 
  434. tickmenu(Displaymenu%, 
  435. sortmenunumber(alphasort), 
  436. $<   
  437. tickmenu(Displaymenu%, 
  438. sortmenunumber(prefsort), 
  439.    prefsort=alphasort
  440. 8    
  441. forceredraw(win_modules)
  442.  currenthandle%=Mainmenu% 
  443. VC   
  444.  Fontmenu%=-1 
  445. reopenmenu(currenthandle%, menux%, menuy%)
  446.  ** Parse help strings **
  447.  loop=1 
  448.  nummodules
  449.  (status?loop=3 
  450.  status?loop=4) 
  451. gethelpinfo(help$(loop), name$(loop), ver$(loop), spec$(loop))
  452. timeout(loop)
  453. faintmenu(Displaymenu%, menu_longname, 
  454. faintmenu(Displaymenu%, menu_showver, 
  455. faintmenu(Displaymenu%, menu_showspec, 
  456. changed=
  457.  oldshowname=Long 
  458.    changed=
  459.    showname=
  460. tickmenu(Displaymenu%, menu_longname, 
  461. tickmenu(Displaymenu%, menu_shortname, 
  462.  oldshowver=
  463.    changed=
  464.    showver=
  465. 2/   
  466. tickmenu(Displaymenu%, menu_showver, 
  467.  oldshowspec=
  468.    changed=
  469.    showspec=
  470. d0   
  471. tickmenu(Displaymenu%, menu_showspec, 
  472.  changed 
  473. recalctabs
  474. moduleextent
  475. forceredraw(win_modules)
  476.  currenthandle%=Mainmenu% 
  477.  Fontmenu%=-1 
  478. reopenmenu(currenthandle%, menux%, menuy%)
  479.  ** Build version sort order **
  480. buildsort(versionsort, ver$())
  481. faintmenu(Displaymenu%, menu_sortver, 
  482.  oldprefsort=versionsort 
  483. tickmenu(Displaymenu%, 
  484. sortmenunumber(versionsort), 
  485. tickmenu(Displaymenu%, 
  486. sortmenunumber(prefsort), 
  487.    prefsort=versionsort
  488. "    
  489. forceredraw(win_modules)
  490.  currenthandle%=Mainmenu% 
  491. @C   
  492.  Fontmenu%=-1 
  493. reopenmenu(currenthandle%, menux%, menuy%)
  494.  "Hourglass_Off"
  495. rammodules
  496.  modnum, modinst, oldmodnum, oldmodinst, base, postfix
  497.  change, name$
  498. modnum=0
  499. modinst=0
  500. nummodules=0
  501.    nummodules+=1
  502. ,   oldmodnum=modnum : oldmodinst=modinst
  503.  "XOS_Module", 12, modnum, modinst 
  504.  ,modnum,modinst,base,,postfix
  505. 6   change=modnum-oldmodnum+(modinst-oldmodinst)*10
  506.  change<>0 
  507. "      modbase(nummodules)=base
  508. ,      name$=
  509. readstring(base+base!16, 0)
  510. &8      help$(nummodules)=
  511. readstring(base+base!20, 0)
  512. 0;      
  513.  modinst<>0 
  514.  name$+="%"+
  515. readstring(postfix, 0)
  516. :       mod$(nummodules)=name$
  517. D-      
  518. (name$)>modlen 
  519.  modlen=
  520. (name$)
  521. N,      sequencesort?nummodules=nummodules
  522.       nummodules-=1
  523.  change=0
  524. rommodules
  525.  num, modnum, modsect, romstat, statlen
  526.  ramnum, oldramnum, match, ver, ver$
  527.  rom$(), ukver$
  528.  rom$(maxmodules)
  529. ukver$=
  530. mess("UKVer")
  531. ,modnum=0 : modsect=-1 : num=0 : ramnum=0
  532.    num+=1
  533.  "XOS_Module", 20, modnum, modsect 
  534.  r0,modnum,modsect,name,romstat,,ver
  535.    ver$=
  536. ~(ver)))
  537.  #   ver$=
  538. ver$,1)+"."+
  539. ver$,2,2)
  540.  r0=20 
  541. 4(      rom$(num)=
  542. readstring(name, 0)
  543.       
  544.  romstat<>-1 
  545. H'         match=
  546.  : oldramnum=ramnum
  547.          ramnum+=1
  548.          
  549. f*            
  550.  mod$(ramnum)=rom$(num) 
  551. p*               status?ramnum=romstat+4
  552. z0               
  553.  romstat=0 
  554.  status?ramnum=2
  555. (               statlen=status?ramnum
  556.                match=
  557.             
  558. 6               
  559.  status?ramnum=0 
  560.  status?ramnum=1
  561.                ramnum+=1
  562. 1               
  563.  ramnum>nummodules 
  564.  ramnum=1
  565.             
  566. '         
  567.  match 
  568.  ramnum=oldramnum
  569.       
  570. "      
  571.  match 
  572.  romstat=-1 
  573.          nummodules+=1
  574. '         mod$(nummodules)=rom$(num)
  575. (         name$(nummodules)=rom$(num)
  576. )         ver$(nummodules)=ver$+ukver$
  577. (         status?nummodules=romstat+4
  578. &         statlen=status?nummodules
  579. $/         sequencesort?nummodules=nummodules
  580.          ramnum=oldramnum
  581.       
  582. B(      statlen=
  583. (modstatus$(statlen))
  584. L1      
  585.  statlen>statuslen 
  586.  statuslen=statlen
  587. timeout(num)
  588.  r0<>20
  589. timeout(num)
  590.  num 
  591.  modulestep=0 
  592.  "Hourglass_Off"
  593. poll(idlemask)
  594.  "Hourglass_On"
  595. buildsort(sort, array$())
  596.  inspos, stop, cond, test, origtest, first, last
  597.  module=1 
  598.  nummodules
  599.  module=1 
  600.       inspos=1
  601.       sort?inspos=module
  602.       first=1
  603.       last=module
  604.       
  605. d%         inspos=
  606. ((first+last)/2)
  607. n9         origtest=array$(module)<=array$(sort?inspos)
  608. x4         
  609.  origtest 
  610.  last=inspos 
  611.  first=inspos
  612.       
  613.  last-first<4
  614.       inspos=
  615. (module/2)
  616. 6      origtest=array$(module)<=array$(sort?inspos)
  617. '      
  618.  origtest 
  619.  cond=-1 
  620.  cond=1
  621.       stop=
  622.       
  623. 7         test=(array$(module)<=array$(sort?inspos))
  624. &         
  625.  test<>origtest 
  626.  stop=
  627. 0         
  628.  inspos=module 
  629.  inspos=1 
  630.  stop=
  631. "         
  632.  stop inspos+=cond
  633.       
  634.  stop
  635.       
  636.  inspos<module 
  637. +         
  638.  test 
  639.  cond=-1 
  640.  inspos+=1
  641. *         
  642.  loop=module 
  643.  inspos+1 
  644. '            sort?loop=sort?(loop-1)
  645.          
  646.       
  647.       sort?inspos=module
  648. timeout(module)
  649. moduleextent
  650. !block%=0
  651. block%!4=-nummodules*32-8
  652. block%!8=maxlen*16+8
  653. block%!12=0
  654.  "Wimp_SetExtent", win_modules, block%
  655.  winopen_modules 
  656. openmodulewindow
  657. openmodulewindow
  658. !block%=win_modules
  659.  "Wimp_GetWindowState",,block%
  660. !block%=win_modules
  661. block%!4=0
  662. block%!8=topiconbar
  663. block%!12=modwinwidth
  664. block%!16=MaxYCoord-44
  665. block%!20=0
  666. block%!24=0
  667.  "Wimp_OpenWindow",,block%
  668. winopen_modules=
  669. modnumber(my%)=
  670. winline(win_modules, my%)
  671. winline(win, my%)
  672.  worky, line
  673. !block%=win
  674.  "Wimp_GetWindowState",,block%
  675. #worky=my%-(block%!16-block%!24)
  676. line=
  677. (-worky/32)+1
  678.     =line
  679. gethelpinfo(help$, 
  680.  name$, 
  681.  ver$, 
  682.  spec$)
  683. help$, tab$)
  684. name$=
  685. help$, pos-1)
  686. help$=
  687. help$, 
  688. (help$)-pos)
  689. help$,1)=tab$
  690. *    help$=
  691. help$, 
  692. (help$)-1)
  693. help$, ")")
  694.  pos=0 
  695.  pos=
  696. (help$) 
  697.    ver$=help$
  698.    spec$=""
  699.    ver$=
  700. help$, pos)
  701. z$   spec$=
  702. help$, 
  703. (help$)-pos-1)
  704. (name$)>namelen 
  705.  namelen=
  706. (name$)
  707. (ver$)>verlen 
  708.  verlen=
  709. (ver$)
  710. (spec$)>speclen 
  711.  speclen=
  712. (spec$)
  713. fillinmodinfo
  714.  help$, name$, ver$, spec$
  715.  pos, tab$, modnum, num
  716. num=prefsort?selmod
  717.  name$(num)="" 
  718. gethelpinfo(help$(num), name$(num), ver$(num), spec$(num))
  719. writeicon(win_modinfo, icon_modname, name$(num))
  720. writeicon(win_modinfo, icon_modver, ver$(num))
  721. writeicon(win_modinfo, icon_modspecial, spec$(num))
  722. writeicon(win_modinfo, icon_modstatus, modstatus$(status?num))
  723. recalctabs
  724.  showname=Short 
  725.  maxlen=modlen 
  726.  maxlen=namelen
  727.  showver 
  728.    vertab=maxlen+1
  729.    maxlen+=verlen+1
  730.  showstatus 
  731.    statustab=maxlen+1
  732.    maxlen+=statuslen+1
  733.  showspec 
  734.    spectab=maxlen+1
  735.    maxlen+=speclen+1
  736. modwinwidth=8+maxlen*16
  737. modcommand(cmd$)
  738.  flags, r0, mod, mod$
  739.  wasrom, inst, base, postfix
  740. mod=prefsort?selmod
  741. mod$=mod$(mod)
  742.  "XOS_CLI", cmd$+" "+mod$ 
  743.  r0; flags
  744.  (flags 
  745.  1)>0 
  746. report(
  747. messarg("ModErr", cmd$, mod$(mod), "", "")+
  748. readstring(r0+4, 0)) : 
  749. wasrom=(status?mod)>=2
  750.  cmd$ 
  751.  "Unplug"
  752. .      
  753.  wasrom 
  754. report(
  755. mess("UnRAM"))
  756.       status?mod=3
  757.  "RMReInit", "RMFaster"
  758. B      
  759.  "XOS_Module", 18, mod$ 
  760.  r0,,inst,base,,postfix;flags
  761. J      
  762.  (flags 
  763.  1)>0 
  764. report(
  765. mess("NoMod")+
  766. readstring(r0+4, 0)):
  767.       modbase(mod)=base
  768. 0      mod$(mod)=
  769. readstring(base+base!16, 0)
  770. 1      help$(mod)=
  771. readstring(base+base!20, 0)
  772. <      
  773.  inst<>0 
  774.  mod$(mod)+="%"+
  775. readstring(postfix, 0)
  776. E      
  777. gethelpinfo(help$(mod), name$(mod), ver$(mod), spec$(mod))
  778.       
  779.  cmd$="RMReInit" 
  780. $         
  781.  wasrom 
  782.  status?mod=1
  783.       
  784.          status?mod=2
  785.       
  786.  "RMKill"
  787.       
  788.  wasrom 
  789.          status?mod=4
  790.       
  791. ^&         
  792.  loop=mod 
  793.  nummodules-1
  794. h'            mod$(loop)=mod$(loop+1)
  795. r)            name$(loop)=name$(loop+1)
  796. |'            ver$(loop)=ver$(loop+1)
  797. )            spec$(loop)=spec$(loop+1)
  798. +            status?loop=status?(loop+1)
  799.          
  800. *         
  801. deletemod(sequencesort, mod)
  802. '         
  803. deletemod(alphasort, mod)
  804. )         
  805. deletemod(versionsort, mod)
  806.          nummodules-=1
  807.          
  808. moduleextent
  809.       
  810. forceredraw(win_modules)
  811. deletemod(sort, num)
  812.  mod, shift
  813. shift=
  814.  mod=1 
  815.  nummodules
  816.  shift 
  817.       
  818.  sort?mod>=num 
  819.          
  820.  sort?mod=num 
  821.             shift=
  822.          
  823.             sort?mod-=1
  824.          
  825.       
  826.  shift 
  827.       sort?mod=sort?(mod+1)
  828. &      
  829.  sort?mod>num 
  830.  sort?mod-=1
  831. modhelp
  832.  offset, mod, string$, code, info, syntax, help, loop
  833.  min, map, max, flags, filesystem, configure, codehelp
  834.  helpbuf, buffer, bufbase, numlines, firstmatch, match, metaflags, lineflags
  835. mod=prefsort?selmod
  836. offset=modbase(mod)!&18
  837. !>Ohelpbuf=
  838. startnewbuffer(
  839. messarg("Help", 
  840. mess("HMod"), mod$(mod), "", ""))
  841. HelpInfo=
  842. !R2buffer=textbuffer(helpbuf, _Start)+_TextOffset
  843. bufbase=buffer
  844. helpline=0
  845. writebuffer(buffer, 
  846. striptabs(help$(mod)))
  847.  offset<>0 
  848.  loop=1 
  849. .      offset=modbase(mod)+modbase(mod)!&18
  850.       firstmatch=
  851.       
  852. +         string$=
  853. readstring(offset, 0)
  854.          
  855.  string$<>"" 
  856. $            offset+=
  857. (string$)+1
  858. 0            
  859.  offset 
  860.  4<>0 : offset+=1 : 
  861.             code=!offset
  862.             flags=offset?7
  863. -            filesystem=(flags 
  864.  (1<<7))>0
  865. ,            configure=(flags 
  866.  (1<<6))>0
  867. +            codehelp=(flags 
  868.  (1<<5))>0
  869.             help=offset!12
  870. E            metaflags=(code<>0)*-1 + filesystem*-2 + configure*-4
  871. 4            lineflags=codehelp*-1 + configure*-2
  872.             match=
  873. ".G            
  874.  meta-flags: code bit 0, filesystem bit 1, configure 2
  875. "8G            
  876.  help flags: code help bit 0, configure bit 1, type<<2
  877.             
  878.  loop 
  879. "L,               
  880.  1 : match=(metaflags=1)
  881. "V,               
  882.  2 : match=(metaflags=3)
  883. "`,               
  884.  3 : match=(metaflags=5)
  885. "j,               
  886.  4 : match=(metaflags=0)
  887.             
  888.             
  889.  match 
  890. %               lineflags+=loop<<2
  891. !               
  892.  firstmatch 
  893. .                  
  894. writebuffer(buffer, "")
  895. ;                  
  896. writebuffer(buffer, helpcode$(loop))
  897. .                  
  898. writebuffer(buffer, "")
  899. "                  firstmatch=
  900.                
  901. 0               
  902. writebuffer(buffer, string$)
  903. 3               helpflags?(helpline-1)=lineflags
  904. L               
  905.  help<>0 
  906.  helpbuffer!((helpline-1)*4)=help+modbase(mod)
  907.             
  908.             offset+=16
  909.          
  910.       
  911.  string$=""
  912. writebuffer(buffer, "")
  913. capbuffer(helpbuf, buffer)
  914. openwindow(textbuffer(helpbuf, _Handle))
  915. striptabs(str$)
  916.    pos=
  917. str$, 
  918.  pos<>0 
  919.       
  920. str$, pos, 1)=" "
  921.  pos=0
  922.     =str$
  923. writebuffer(
  924.  buffer, str$)
  925. $buffer=str$
  926. buffer+=
  927. (str$)+1
  928. helpbuffer!(helpline*4)=0
  929. helpflags?helpline=0
  930. helpline+=1
  931. startnewbuffer(title$)
  932.  slotsize, next, free, newhigh, loop, bufnum, start
  933.  "Wimp_SlotSize", -1, -1 
  934.  slotsize, next, free
  935.  free=0 
  936.  bufferwindows=16 
  937. report(
  938. mess("NoMem")) : 
  939. pollloop
  940. newhigh=
  941. +slotsize+free
  942. =newhigh
  943. bufferwindows+=1
  944. bufnum=0
  945.  loop=1 
  946.  bufferwindows
  947.  textbuffer(loop, _Start)=-1 
  948.  bufnum=loop
  949.  bufnum=0 
  950. =BufferHigh : 
  951. report(
  952. mess("NoVFree")) : 
  953. pollloop
  954. bufferstate=bufnum
  955. &textbuffer(bufferwindows, _Help)=0
  956. 'textbuffer(bufferwindows, _Flags)=0
  957. HelpInfo=
  958. 0textbuffer(bufferwindows, _Start)=BufferHigh
  959. +textbuffer(bufferwindows, _End)=newhigh
  960. start=BufferHigh
  961. modhelpwin!72=start
  962. modhelpwin!4-=bufnum*40
  963. modhelpwin!12-=bufnum*40
  964.  "Wimp_CreateWindow",,modhelpwin 
  965.  textbuffer(bufferwindows, _Handle)
  966. modhelpwin!4+=bufnum*40
  967. modhelpwin!12+=bufnum*40
  968. %0"$start=
  969. title$, _TextOffset-1)
  970. BufferHigh=newhigh
  971. =bufferwindows
  972. capbuffer(bufnum, endbuf)
  973.  start, info, flags, help, loop
  974.  parse enters with pointer to text in r0, lines in r1, info in r2, last char in r3
  975.  stores numlines in r2+0, width in r2+4
  976.  r4 number of chars, r5 number of lines, r6 character, r7 max width
  977. bufferstate=bufnum*32
  978. info=(endbuf 
  979.  4)*4+8
  980. "textbuffer(bufnum, _Info)=info
  981. 0start=textbuffer(bufnum, _Start)+_TextOffset
  982. A%=start
  983. B%=info+8
  984. C%=info
  985. D%=endbuf
  986.  parse
  987.  HelpInfo 
  988.    flags=info+16+!info*4
  989.  loop=0 
  990.  helpline-1
  991. &*#      flags?loop=helpflags?loop
  992.    help=flags+helpline+8
  993.  loop=0 
  994.  helpline-1
  995. &R+      help!(loop*4)=helpbuffer!(loop*4)
  996. &f    endbuf=help+helpline*4+16
  997.    endbuf=info+16+!info*4
  998.    help=0
  999.    flags=0
  1000. $textbuffer(bufnum, _Flags)=flags
  1001. "textbuffer(bufnum, _Help)=help
  1002. #textbuffer(bufnum, _End)=endbuf
  1003.  endbuf<BufferHigh 
  1004.    BufferHigh=endbuf
  1005. =BufferHigh
  1006. !block%=0
  1007. block%!4=-!info*32-40
  1008. block%!8=(info!4)*16+8
  1009. block%!12=0
  1010.  "Wimp_SetExtent", textbuffer(bufnum, _Handle), block%
  1011. bufferstate=-1
  1012. removebuffer(bufnum)
  1013.  start, end
  1014.  textbuffer(bufnum, _End)=BufferHigh 
  1015. 'jM   
  1016.  bufferwindows=1 
  1017.  start=BufferLow 
  1018.  start=textbuffer(bufnum, _Start)
  1019.    BufferHigh=start
  1020. =BufferHigh
  1021. $   textbuffer(bufnum, _Start)=-1
  1022.  bufnum=bufferwindows 
  1023.  bufferwindows-=1
  1024. *   !block%=textbuffer(bufnum, _Handle)
  1025.  "Wimp_DeleteWindow",,block%
  1026. bufferstate=0
  1027. bufwindow(win)
  1028.  loop, buffer
  1029. buffer=0
  1030.  loop=1 
  1031.  bufferwindows
  1032.  textbuffer(loop, _Handle)=win 
  1033.  buffer=loop
  1034. =buffer
  1035. gethelp(buffer, line)
  1036.  info, numlines, command$, newbuf, newbuffer, flags, help, type, mess$, gothelp
  1037. (Z"info=textbuffer(buffer, _Info)
  1038. line-=1
  1039. numlines=!info
  1040.  line>numlines 
  1041. report(
  1042. mess("LastLine")) : 
  1043. pointer=!(info+8+line*4)
  1044.  !pointer=arrow 
  1045.  pointer+=4
  1046. command$=$pointer
  1047.  command$="" 
  1048.  command$=
  1049. (10) 
  1050. $flags=textbuffer(buffer, _Flags)
  1051. "help=textbuffer(buffer, _Help)
  1052.  gothelp=(flags<>0 
  1053.  help<>0)
  1054.  gothelp 
  1055.    flags=flags?line
  1056.    help=help!(line*4)
  1057.    type=(flags 
  1058.  3))>>2
  1059.  type 
  1060.        
  1061.  1    : mess$="HComm"
  1062.       
  1063.  2    : mess$="HFil"
  1064.        
  1065.  3    : mess$="HConf"
  1066. )"       
  1067.  4    : mess$="HHelp"
  1068.       
  1069.  : mess$="HKeyw"
  1070. )@>   
  1071.  help flags: code help bit 0, configure bit 1, type<<2
  1072.    mess$="HKeyw"
  1073. )hLnewbuf=
  1074. startnewbuffer(
  1075. messarg("Help", 
  1076. mess(mess$), command$, "", ""))
  1077. )r4newbuffer=textbuffer(newbuf, _Start)+_TextOffset
  1078. !bufpointer=newbuffer
  1079. 4!bufmaxsize=textbuffer(newbuf, _End)-newbuffer-4
  1080. setwindowsize
  1081.  claim
  1082.  gothelp 
  1083.  (flags 
  1084.  1)=0 
  1085.  type<>0 
  1086. 3      
  1087. messarg("DHelp", command$, "", "", "")
  1088.       
  1089.  help<>0 
  1090. 3         
  1091.  "OS_PrettyPrint", help, 0, command$
  1092.       
  1093.          
  1094. mess("NoHelp")
  1095.       
  1096. '      
  1097.  "OS_CLI", "Help "+command$
  1098. *&$   
  1099.  "OS_CLI", "Help "+command$
  1100.  release
  1101. newbuffer+=!counter
  1102. capbuffer(newbuf, newbuffer)
  1103. openwindow(textbuffer(newbuf, _Handle))
  1104. openhelpwindow
  1105. writeicon(win_help, icon_helptext, "")
  1106. openwindow(win_help)
  1107. setcaret(win_help, icon_helptext)
  1108. opencommandwindow
  1109. writeicon(win_command, icon_commandmain, "")
  1110.  loop=icon_arg1 
  1111.  icon_arg4
  1112. writeicon(win_command, loop, "")
  1113. faint(win_command, loop, 
  1114. faint(win_command, icon_value, 
  1115. openwindow(win_command)
  1116. setcaret(win_command, icon_commandmain)
  1117. command(command$, title$)
  1118.  newbuf, newbuffer
  1119. "newbuf=
  1120. startnewbuffer(title$)
  1121. 4newbuffer=textbuffer(newbuf, _Start)+_TextOffset
  1122. !bufpointer=newbuffer
  1123. 4!bufmaxsize=textbuffer(newbuf, _End)-newbuffer-4
  1124. setwindowsize
  1125.  claim
  1126.  "OS_CLI", command$
  1127.  release
  1128.  !counter>1 
  1129.    newbuffer+=!counter
  1130. capbuffer(newbuf, newbuffer)
  1131. openwindow(textbuffer(newbuf, _Handle))
  1132. removebuffer(newbuf)
  1133. helpcommand
  1134.  keyword$, title$
  1135. closewindow(win_help)
  1136. ,j/keyword$=
  1137. readicon(win_help, icon_helptext)
  1138. ,t=title$=
  1139. messarg("Help", 
  1140. mess("HKeyw"), keyword$, "", "")
  1141. command("Help "+keyword$, title$)
  1142. starcommand
  1143.  keyword$, icon, arg$
  1144. closewindow(win_command)
  1145. 5keyword$=
  1146. readicon(win_command, icon_commandmain)
  1147. valid(keyword$) 
  1148. opencommandwindow
  1149.  icon=icon_arg1 
  1150.  icon_arg4
  1151. (   arg$=
  1152. readicon(win_command, icon)
  1153.  arg$<>"" 
  1154.  keyword$+=" "+arg$
  1155. -21title$=
  1156. messarg("CRes", keyword$, "", "", "")
  1157. command(keyword$, title$)
  1158. getcommand(buffer, line)
  1159.  info, numlines, command$, pointer, space, flags, type, help, gothelp, careticon, main$
  1160. "info=textbuffer(buffer, _Info)
  1161. line-=1
  1162. numlines=!info
  1163.  line>numlines 
  1164. report(
  1165. mess("LastLine")) : 
  1166. pointer=!(info+8+line*4)
  1167.  !pointer=arrow 
  1168.  pointer+=4
  1169. command$=$pointer
  1170. space=
  1171. command$, " ")
  1172.  space>0 
  1173.  command$=
  1174. command$, space)
  1175.  command$="" 
  1176.  command$=
  1177. (10) 
  1178. $flags=textbuffer(buffer, _Flags)
  1179. "help=textbuffer(buffer, _Help)
  1180.  gothelp=(flags<>0 
  1181.  help<>0)
  1182. type=0
  1183.  gothelp 
  1184.    flags=flags?line
  1185.    type=(flags 
  1186.  3))>>2
  1187. opencommandwindow
  1188. careticon=icon_commandmain
  1189.  type 
  1190. .h6      
  1191. writeicon(win_command, icon_arg1, command$)
  1192. .r+      
  1193. faint(win_command, icon_arg1, 
  1194.       careticon=icon_arg1
  1195.       
  1196.  type 
  1197. K         
  1198.  3: main$=
  1199. mess("CConf") : 
  1200. faint(win_command, icon_value, 
  1201. &         
  1202.  4: main$=
  1203. mess("CHelp")
  1204.       
  1205.       main$=command$
  1206. writeicon(win_command, icon_commandmain, main$)
  1207. setcaret(win_command, careticon)
  1208. commandhelp
  1209.  keyword$, cmd$
  1210. 5keyword$=
  1211. readicon(win_command, icon_commandmain)
  1212. cmd$=
  1213. caseless(keyword$)
  1214. cmd$)=" " 
  1215.  cmd$=
  1216. cmd$)
  1217.  cmd$="configure" 
  1218.  cmd$="status" 
  1219.  cmd$="help" 
  1220. /N1   keyword$=
  1221. readicon(win_command, icon_arg1)
  1222. command("Help "+keyword$, 
  1223. messarg("Help", 
  1224. mess("HComm"), keyword$, "", ""))
  1225. valid(keyword$)
  1226.  cmd$, counter, legal
  1227. cmd$=
  1228. caseless(keyword$)
  1229. counter=0
  1230. legal=
  1231.  cmd$=illegal$(counter) 
  1232. ;      
  1233. report(
  1234. messarg("IllCom", keyword$, "", "", ""))
  1235.       legal=
  1236.    counter+=1
  1237.  illegal$(counter)=""
  1238. =legal
  1239. showvalue
  1240.  command$, key$, mess$, arg$
  1241. 0>@command$=
  1242. caseless(
  1243. readicon(win_command, icon_commandmain))
  1244. command$)=" " 
  1245.  command$=
  1246. command$)
  1247.  command$ 
  1248. 0\3   
  1249.  "configure" : key$="status" : mess$="VCon"
  1250. 0f3   
  1251.  "set"       : key$="show"   : mess$="VVar"
  1252. 0p3   
  1253.  "seteval"   : key$="show"   : mess$="VNum"
  1254. 0z3   
  1255.  "setmacro"  : key$="show"   : mess$="VMac"
  1256. *arg$=
  1257. readicon(win_command, icon_arg1)
  1258. arg$)=" " 
  1259.  arg$=
  1260. arg$)
  1261. command(key$+" "+arg$, 
  1262. messarg("Val", 
  1263. mess(mess$), arg$, "", ""))
  1264. checkvalue
  1265.  command$, value
  1266. @command$=
  1267. caseless(
  1268. readicon(win_command, icon_commandmain))
  1269. command$)=" " 
  1270.  command$=
  1271. command$)
  1272. \value=(command$="set" 
  1273.  command$="seteval" 
  1274.  command$="setmacro" 
  1275.  command$="configure")
  1276. faint(win_command, icon_value, 
  1277.  value)
  1278. openmousewindow
  1279.  type, item
  1280. openwindow(win_mouseact)
  1281. 1V!tempmouseclick()=mouseclick()
  1282.  type=_Iconbar 
  1283.  _Window
  1284.  item=0 
  1285. 1t(      
  1286. displaymouseclick(type, item)
  1287. displaymouseclick(_Window, 3)
  1288. setmouseclick(type, item, val)
  1289.  loop
  1290.  loop=0 
  1291.  tempmouseclick(type, loop)=val 
  1292. &      tempmouseclick(type, loop)=0
  1293. (      
  1294. displaymouseclick(type, loop)
  1295. "tempmouseclick(type, item)=val
  1296. displaymouseclick(type, item)
  1297.  button, out$, pref$, icon
  1298. 2Z%button=tempmouseclick(type, item)
  1299.  type=_Iconbar 
  1300.  icon=icon_iconbarclick 
  1301.  icon=icon_winclick
  1302.  button>0 
  1303.    pref$=""
  1304.  (button 
  1305.  _Shift)>0 
  1306.  pref$="Shift"
  1307.  (button 
  1308.  _Ctrl)>0 
  1309.  pref$="Ctrl"
  1310.  (button 
  1311.  _Alt)>0 
  1312.  pref$="Alt"
  1313.  pref$<>"" 
  1314.  pref$=
  1315. mess(pref$)+" "
  1316.  (button 
  1317.  _Select)>0 
  1318.  out$=pref$+
  1319. mess("Sel") 
  1320.  out$=pref$+
  1321. mess("Adj")
  1322. writeicon(win_mouseact, icon+item*2, out$)
  1323. writeicon(win_mouseact, icon+item*2, "")
  1324. last(string$, char$)
  1325.  oldpos, pos
  1326. oldpos=-1
  1327. 3"%   pos=
  1328. string$, char$, oldpos+1)
  1329.  pos<>0 
  1330.  oldpos=pos
  1331.  pos=0
  1332.  oldpos=-1 
  1333.  =oldpos
  1334. savebox(win, openmenu)
  1335.  title$, last, save$, open$, close$, pos
  1336.  win=win_modules 
  1337. savebuffer=
  1338. bufwindow(win)
  1339.  title$=
  1340. readwindowtitle(win)
  1341. open$=
  1342. mess("QuotOpen")
  1343. close$=
  1344. mess("QuotClosed")
  1345. title$, 1)=close$ 
  1346.    pos=
  1347. last(title$, open$)
  1348.  pos=0 
  1349.       title$="Viewer"
  1350. 1      title$=
  1351. title$, pos+1, 
  1352. (title$)-pos-1)
  1353. last(title$, " ")
  1354.  pos=0 
  1355.    save$=title$
  1356. 4&$   save$=
  1357. title$, 
  1358. (title$)-pos)
  1359. writeicon(win_saveas, icon_savetext, 
  1360. save$, 10))
  1361.  openmenu 
  1362. openmenudbox(win_saveas)
  1363. setwindowsize
  1364. !block%=132
  1365. block%!4=133
  1366. block%!8=134
  1367. block%!12=135
  1368. block%!16=-1
  1369.  "OS_ReadVduVariables", block%, block%+20
  1370.  4, 28, block%!20, block%!24, block%!28-3, block%!32
  1371. savechoices
  1372.  handle, loop, loop2
  1373. handle=
  1374. (alias$+".Choices")
  1375.  prefsort 
  1376. 5 !   
  1377.  alphasort : 
  1378.  #handle, 1
  1379. 5*$   
  1380.  sequencesort : 
  1381.  #handle, 2
  1382. 54#   
  1383.  versionsort : 
  1384.  #handle, 3
  1385.  #handle, showname, showver, showspec, showstatus
  1386.  #handle, headcolour, textcolour, greycolour
  1387.  #handle, headfont$, textfont$, greyfont$
  1388.  loop=0 
  1389.  loop2=0 
  1390. 5z,      
  1391.  #handle, mouseclick(loop, loop2)
  1392. #handle
  1393. ("SetType "+alias$+".Choices Data")
  1394. loadchoices
  1395.  handle, loop, loop2, sort
  1396. handle=
  1397. (alias$+".Choices")
  1398.  handle=0 
  1399. defaultchoices:
  1400. #handle, sort
  1401.  sort 
  1402.  1 : prefsort=alphasort
  1403.  2 : prefsort=sequencesort
  1404.  3 : prefsort=versionsort
  1405.  #handle, showname, showver, showspec, showstatus
  1406.  #handle, headcolour, textcolour, greycolour
  1407.  #handle, headfont$, textfont$, greyfont$
  1408.  loop=0 
  1409.  loop2=0 
  1410. 6`,      
  1411.  #handle, mouseclick(loop, loop2)
  1412. #handle
  1413. oldprefsort=prefsort
  1414. oldshowname=showname
  1415. oldshowver=showver
  1416. oldshowspec=showspec
  1417. oldshowstatus=showstatus
  1418. refreshchoices
  1419. setfont(headfont$, "Homerton.Bold", headhandle)
  1420. setfont(textfont$, "Trinity.Medium", texthandle)
  1421. setfont(greyfont$, "Trinity.Medium.Italic", greyhandle)
  1422. redrawwindows
  1423. defaultchoices
  1424. prefsort=sequencesort
  1425. showname=Short
  1426. showver=
  1427. showspec=
  1428. showstatus=
  1429. headcolour=11
  1430. textcolour=7
  1431. greycolour=3
  1432. headfont$="Homerton.Bold"
  1433. textfont$="Trinity.Medium"
  1434. %greyfont$="Trinity.Medium.Italic"
  1435. cmouseclick()=_Select,_Adjust,_Shift+_Select,0, _Select, _Adjust, _Shift+_Select, _Shift+_Adjust
  1436.  Errors
  1437. finish
  1438. mess("Err")+
  1439.  !bufferclaimed=1 
  1440.  release
  1441. $block%="TASK"
  1442.  WimpInit 
  1443.  "Wimp_CloseDown", TaskHandle, !block%
  1444. error
  1445.  result
  1446. , "Internal error code "+
  1447. )+": "+
  1448.  bufferclaimed<>-1 
  1449. 8h%   
  1450.  !bufferclaimed=1 
  1451.  release
  1452. !block%=
  1453. 0$(block%+4)=
  1454. mess("Err")+
  1455. )+": "+
  1456. $+"."+
  1457.  "Wimp_ReportError", block%, 3, taskname$ 
  1458.  ,result
  1459.  result=2 
  1460. areyousure
  1461. error : 
  1462.  doneiconbar 
  1463. faint(-2, baricon%, 
  1464.  bufferstate<>-1 
  1465.  bufferstate<=16 
  1466. E      
  1467. capbuffer(bufferstate, textbuffer(bufferstate, _Start)+16)
  1468. )      
  1469. removebuffer(bufferstate 
  1470. pollloop
  1471. areyousure
  1472.  result
  1473. $(block%+4)=
  1474. mess("Sure")
  1475.  "Wimp_ReportError", block%, 23, 
  1476. mess("Mess")+taskname$ 
  1477.  ,result
  1478.  result=1 
  1479. finish
  1480. report(string$)
  1481.  text$
  1482. !block%=0
  1483. $(block%+4)=string$
  1484.  "Wimp_ReportError", block%, 3, taskname$ 
  1485.  ,result
  1486.  result=2 
  1487. areyousure
  1488.  Keys
  1489. checkkeys
  1490.  window, icon, caretpos, char, command$
  1491.  icon$, add$, nexticon
  1492. window=!block%
  1493. icon=block%!4
  1494. caretpos=block%!20
  1495. char=block%!24
  1496. process=
  1497.  window 
  1498.  win_command
  1499. /      
  1500.  icon=icon_commandmain 
  1501. checkvalue
  1502.       
  1503.  char 
  1504.           
  1505.  13 : 
  1506. starcommand
  1507. -         
  1508.  27 : 
  1509. closewindow(win_command)
  1510.          
  1511. "            
  1512.  icon<icon_arg4 
  1513. 1               
  1514. faint(win_command, icon+1, 
  1515. 0               icon$=
  1516. readicon(window, icon)
  1517. (               
  1518. (icon$)>caretpos 
  1519. A                  
  1520. writeicon(window, icon, 
  1521. icon$, caretpos))
  1522. ;$7                  add$=
  1523. icon$, 
  1524. (icon$)-caretpos-1)
  1525. ;.%                  nexticon=icon+1
  1526. ;86                  
  1527.  nexticon<icon_arg4 
  1528.  add$<>""
  1529. ;B:                     icon$=
  1530. readicon(window, nexticon)
  1531. ;L&                     
  1532.  icon$<>"" 
  1533. ;V>                        
  1534. writeicon(window, nexticon, add$)
  1535. ;`&                        add$=icon$
  1536.                      
  1537. ;t>                        
  1538. writeicon(window, nexticon, add$)
  1539. ;~#                        add$=""
  1540. 7                        
  1541. faint(window, nexticon, 
  1542.                      
  1543. $                     nexticon+=1
  1544.                   
  1545. "                  
  1546.  add$<>"" 
  1547. ;                     icon$=
  1548. readicon(window, icon_arg4)
  1549. F                     
  1550. writeicon(window, icon_arg4, add$+" "+icon$)
  1551.                   
  1552.                
  1553. 1               
  1554. setcaret(win_command, icon+1)
  1555.             
  1556. O         
  1557.  8, 127, &18F, &19F, &1AF, &1BF : 
  1558.  backspace, delete or up-arrow
  1559. )            
  1560.  icon>icon_commandmain 
  1561. 6               
  1562. readicon(win_command, icon)="" 
  1563. 2                  
  1564. faint(win_command, icon, 
  1565. K                  
  1566.  icon=icon_arg1 
  1567. faint(win_command, icon_value, 
  1568. <(M                  
  1569. writeicon(window, icon-1, 
  1570. readicon(window, icon-1)))
  1571. <24                  
  1572. setcaret(win_command, icon-1)
  1573.                
  1574.             
  1575. <P!         
  1576.  &1AB : 
  1577.  Ctrl-Copy
  1578. <Z1            
  1579. writeicon(win_command, icon, "")
  1580. <d,            
  1581. setcaret(win_command, icon)
  1582. <n4         
  1583.  &18E, &19E, &1AE, &1BE : 
  1584.  down-arrow
  1585. <x"            
  1586.  icon<icon_arg4 
  1587. 3               
  1588. readicon(window, icon+1)="" 
  1589. K                  
  1590. writeicon(window, icon, 
  1591. readicon(window, icon)+" ")
  1592. 4                  
  1593. setcaret(win_command, icon+1)
  1594. 4                  
  1595. faint(win_command, icon+1, 
  1596.                
  1597.             
  1598.          
  1599.  : process=
  1600.       
  1601.  win_help
  1602.       
  1603.  char 
  1604.           
  1605.  13 : 
  1606. helpcommand
  1607. *         
  1608.  27 : 
  1609. closewindow(win_help)
  1610.          
  1611.  : process=
  1612.       
  1613.  : process=
  1614.  process 
  1615.  "Wimp_ProcessKey", char
  1616.  Menus
  1617. menuinit
  1618.  menu 255
  1619. Iconmenu%=
  1620. dimmenu(5)
  1621. Modulemenu%=
  1622. dimmenu(7)
  1623. Mainmenu%=
  1624. dimmenu(4)
  1625. Displaymenu%=
  1626. dimmenu(8)
  1627. Choicesmenu%=
  1628. dimmenu(6)
  1629. Coloursmenu%=
  1630. dimmenu(3)
  1631. Fontsmenu%=
  1632. dimmenu(3)
  1633. Headingmenu%=
  1634. dimmenu(16)
  1635. Normalmenu%=
  1636. dimmenu(16)
  1637. Greyedmenu%=
  1638. dimmenu(16)
  1639. Viewermenu%=
  1640. dimmenu(3)
  1641. Fontmenu%=-1
  1642.  menu$(70), submenu(70)
  1643.  menubuf 70*30
  1644.  validation 4
  1645. !validation=0
  1646. IndMenuPos=0
  1647. dimmenu(numopts)
  1648.  menu% 28+(numopts*24)
  1649. =menu%
  1650. setupmenu(tok$, numents)
  1651.  menu
  1652.  menu=0 
  1653.  numents
  1654. >l&   menu$(menu)=
  1655. mess(tok$+
  1656. (menu))
  1657.    submenu(menu)=-1
  1658. buildmenus
  1659. IndMenuPos=0
  1660. menu_info=0
  1661. menu_modules=1
  1662. menu_help=2
  1663. menu_command=3
  1664. menu_quit=4
  1665. setupmenu("M1", 4)
  1666. submenu(menu_info)=win_info
  1667. menu(
  1668. mess("M1T"), 5, Iconmenu%)
  1669. menu_sortname=0
  1670. menu_sortnum=1
  1671. menu_sortver=2
  1672. menu_shortname=3
  1673. menu_longname=4
  1674. menu_showver=5
  1675. menu_showstatus=6
  1676. menu_showspec=7
  1677. setupmenu("M20", 7)
  1678. /menu$(menu_sortnum)="/"+menu$(menu_sortnum)
  1679. menu(
  1680. mess("M20T"), 8, Displaymenu%)
  1681. menu_modinfo=0
  1682. menu_modhelp=1
  1683. menu_moddelete=2
  1684. menu_modreinit=3
  1685. menu_modunplug=4
  1686. menu_modfaster=5
  1687. menu_modromver=6
  1688. setupmenu("M21", 6)
  1689. %submenu(menu_modinfo)=win_modinfo
  1690. menu(
  1691. mess("M21T"), 7, Modulemenu%)
  1692. colourmenu(Headingmenu%, 
  1693. mess("MColT"))
  1694. colourmenu(Normalmenu%, 
  1695. mess("MColT"))
  1696. colourmenu(Greyedmenu%, 
  1697. mess("MColT"))
  1698. menu_heading=0
  1699. menu_normal=1
  1700. menu_greyed=2
  1701. setupmenu("M220", 2)
  1702. @j&submenu(menu_heading)=Headingmenu%
  1703. @t$submenu(menu_normal)=Normalmenu%
  1704. @~$submenu(menu_greyed)=Greyedmenu%
  1705. menu(
  1706. mess("M220T"), 3, Coloursmenu%)
  1707.  loop=menu_heading 
  1708.  menu_greyed
  1709. "   menu$(loop)="!"+menu$(loop)
  1710. menu(
  1711. mess("M221T"), 3, Fontsmenu%)
  1712. menu_colours=0
  1713. menu_fonts=1
  1714. menu_mouseact=2
  1715. menu_savechoices=3
  1716. menu_revertchoices=4
  1717. menu_defaultchoices=5
  1718. setupmenu("M22", 5)
  1719. &submenu(menu_colours)=Coloursmenu%
  1720. "submenu(menu_fonts)=Fontsmenu%
  1721. menu(
  1722. mess("M22T"), 6, Choicesmenu%)
  1723. menu_viewerhelp=0
  1724. menu_viewercommand=1
  1725. menu_viewersave=2
  1726. setupmenu("M3", 2)
  1727. AZ5menu$(menu_viewersave)="!"+menu$(menu_viewersave)
  1728. Ad'submenu(menu_viewersave)=win_saveas
  1729. menu(
  1730. mess("M3T"), 3, Viewermenu%)
  1731. ModIndPos=IndMenuPos
  1732. buildmodulemenu
  1733. mod=prefsort?selmod
  1734. IndMenuPos=ModIndPos
  1735. menu_display=0
  1736. menu_module=1
  1737. menu_choices=2
  1738. menu_rescan=3
  1739. setupmenu("M2", 3)
  1740. =menu$(menu_module)=
  1741. messarg("M21", mod$(mod), "", "", "")
  1742. &submenu(menu_display)=Displaymenu%
  1743. B"$submenu(menu_module)=Modulemenu%
  1744. B,&submenu(menu_choices)=Choicesmenu%
  1745. menu(
  1746. mess("M2T"), 4, Mainmenu%)
  1747. faintmenu(Modulemenu%, menu_modhelp, status?mod=3 
  1748.  status?mod=4)
  1749. faintmenu(Modulemenu%, menu_moddelete, 
  1750.  moduleop)
  1751. faintmenu(Modulemenu%, menu_modreinit, 
  1752.  moduleop)
  1753. faintmenu(Modulemenu%, menu_modunplug, 
  1754.  (status?mod>=4 
  1755.  moduleop))
  1756. faintmenu(Modulemenu%, menu_modfaster, 
  1757.  (status?mod>=4 
  1758.  moduleop))
  1759. faintmenu(Modulemenu%, menu_modromver, 
  1760.  (status?mod=2) 
  1761.  moduleop)
  1762. tickmenu(Headingmenu%, headcolour, 
  1763. tickmenu(Greyedmenu%, greycolour, 
  1764. tickmenu(Normalmenu%, textcolour, 
  1765. dofunctions
  1766.  choice, loop
  1767. $choice=
  1768. numtohandle(menunumber%)
  1769.  currenthandle% 
  1770.  Iconmenu%
  1771.       
  1772.  choice 
  1773.          
  1774.  Iconmenu%
  1775.             
  1776.  item% 
  1777. C05               
  1778.  menu_modules : 
  1779. openmodulewindow
  1780. C:0               
  1781.  menu_help : 
  1782. openhelpwindow
  1783. CD6               
  1784.  menu_command : 
  1785. opencommandwindow
  1786. CN(               
  1787.  menu_quit : 
  1788. finish
  1789.             
  1790.       
  1791.  Mainmenu%
  1792.       
  1793.  choice 
  1794.          
  1795.  Mainmenu%
  1796.             
  1797.  item% 
  1798.                 
  1799.  menu_rescan
  1800. #                  modulesread=
  1801. *                  oldprefsort=prefsort
  1802. *                  oldshowname=showname
  1803. (                  oldshowver=showver
  1804. *                  oldshowspec=showspec
  1805. .                  oldshowstatus=showstatus
  1806. +                  prefsort=sequencesort
  1807. "                  
  1808. readmodules
  1809.             
  1810.          
  1811.  Displaymenu%
  1812.             
  1813.  item% 
  1814. 8               
  1815.  menu_sortname  : prefsort=alphasort
  1816. ;               
  1817.  menu_sortnum   : prefsort=sequencesort
  1818. D :               
  1819.  menu_sortver   : prefsort=versionsort
  1820. D*4               
  1821.  menu_shortname : showname=Short
  1822. D43               
  1823.  menu_longname  : showname=Long
  1824. D>7               
  1825.  menu_showver   : showver=
  1826.  showver
  1827. DH9               
  1828.  menu_showspec  : showspec=
  1829.  showspec
  1830. DR=               
  1831.  menu_showstatus: showstatus=
  1832.  showstatus
  1833.             
  1834. Df'            
  1835.  item%<=menu_sortver 
  1836. Dp6               
  1837.  loop=menu_sortname 
  1838.  menu_sortver
  1839. DzA                  
  1840. tickmenu(Displaymenu%, loop, (item%=loop))
  1841.                
  1842.             
  1843. G            
  1844. tickmenu(Displaymenu%, menu_shortname, showname=Short)
  1845. E            
  1846. tickmenu(Displaymenu%, menu_longname, showname=Long)
  1847. >            
  1848. tickmenu(Displaymenu%, menu_showver, showver)
  1849. @            
  1850. tickmenu(Displaymenu%, menu_showspec, showspec)
  1851. D            
  1852. tickmenu(Displaymenu%, menu_showstatus, showstatus)
  1853. B            
  1854.  item%>menu_sortver 
  1855. recalctabs : 
  1856. moduleextent
  1857. )            
  1858. forceredraw(win_modules)
  1859.          
  1860.  Modulemenu%
  1861.             
  1862.  item% 
  1863. -               
  1864.  menu_modhelp  : 
  1865. modhelp
  1866. :               
  1867.  menu_moddelete: 
  1868. modcommand("RMKill")
  1869. <               
  1870.  menu_modreinit: 
  1871. modcommand("RMReInit")
  1872. :               
  1873.  menu_modunplug: 
  1874. modcommand("Unplug")
  1875. <               
  1876.  menu_modfaster: 
  1877. modcommand("RMFaster")
  1878. E$T               
  1879.  menu_modromver: 
  1880. modcommand("RMKill") : 
  1881. modcommand("RMReInit")
  1882.             
  1883.          
  1884.  Choicesmenu%
  1885.             
  1886.  item% 
  1887. EL5               
  1888.  menu_mouseact : 
  1889. openmousewindow
  1890. EV4               
  1891.  menu_savechoices : 
  1892. savechoices
  1893. E`(               
  1894.  menu_defaultchoices
  1895. Ej%                  
  1896. defaultchoices
  1897. Et%                  
  1898. refreshchoices
  1899. E~#                  
  1900. moduleextent
  1901. '                  
  1902. openmodulewindow
  1903. '               
  1904.  menu_revertchoices
  1905. "                  
  1906. loadchoices
  1907. %                  
  1908. refreshchoices
  1909. #                  
  1910. moduleextent
  1911. '                  
  1912. openmodulewindow
  1913.             
  1914. F         
  1915.  Headingmenu% : 
  1916. choosecolour(choice, item%, headcolour)
  1917. F         
  1918.  Normalmenu%  : 
  1919. choosecolour(choice, item%, textcolour)
  1920. F         
  1921.  Greyedmenu%  : 
  1922. choosecolour(choice, item%, greycolour)
  1923.          
  1924.             
  1925. decodefontmenu
  1926.       
  1927.  Viewermenu%
  1928.       
  1929.  item% 
  1930. C         
  1931.  menu_viewerhelp : 
  1932. gethelp(viewerbuffer, viewerline)
  1933. F(I         
  1934.  menu_viewercommand : 
  1935. getcommand(viewerbuffer, viewerline)
  1936.       
  1937. choosecolour(menu%, item%, 
  1938.  col)
  1939.  handle
  1940.  col<>item% 
  1941. tickmenu(menu%, col, 
  1942. tickmenu(menu%, item%, 
  1943.    col=item%
  1944. redrawwindows
  1945. redrawwindows
  1946.  loop
  1947. forceredraw(win_modules)
  1948.  loop=0 
  1949.  numbuffers
  1950. '   handle=textbuffer(loop, _Handle)
  1951.  handle<>0 
  1952. forceredraw(handle)
  1953. numtohandle(menunumber%)
  1954.  menuhandle%
  1955.  menunumber% 
  1956. GT$   
  1957.  1 : menuhandle% = Iconmenu%
  1958. G^$   
  1959.  2 : menuhandle% = Mainmenu%
  1960. Gh(   
  1961.  20 : menuhandle% = Displaymenu%
  1962. Gr'   
  1963.  21 : menuhandle% = Modulemenu%
  1964. G|(   
  1965.  22 : menuhandle% = Choicesmenu%
  1966.  220 : menuhandle% = Coloursmenu%
  1967.  2200 : menuhandle% = Headingmenu%
  1968.  2201 : menuhandle% = Normalmenu%
  1969.  2202 : menuhandle% = Greyedmenu%
  1970.  221 : menuhandle% = Fontsmenu%
  1971. =menuhandle%
  1972. handletonum(menuhandle%)
  1973.  menunumber%
  1974.  menuhandle% 
  1975.  Iconmenu% : menunumber%=1
  1976.  Mainmenu% : menunumber%=2
  1977.  Displaymenu% : menunumber%=20
  1978.  Modulemenu% : menunumber%=21
  1979. H&&   
  1980.  Choicesmenu% : menunumber%=22
  1981. H0'   
  1982.  Coloursmenu% : menunumber%=220
  1983. H:(   
  1984.  Headingmenu% : menunumber%=2200
  1985. HD'   
  1986.  Normalmenu% : menunumber%=2201
  1987. HN'   
  1988.  Greyedmenu% : menunumber%=2202
  1989. HX%   
  1990.  Fontsmenu% : menunumber%=221
  1991. =menunumber%
  1992. fontmenu(font$)
  1993.  menubufsize, menuindsize, wantsize
  1994.  menu, ind
  1995.  Fontmenu%<>-1 
  1996.  =Fontmenu%
  1997.  "Font_ListFonts",, 0, (7<<19), 0, 0, 0, 0 
  1998.  ,,,menubufsize,,menuindsize
  1999.  "Wimp_SlotSize", -1, -1 
  2000.  slotsize, , free
  2001. .wantsize=(menubufsize+menuindsize+7) 
  2002.  free>=wantsize 
  2003.    menu=
  2004. %   ind=(menu+menubufsize+3) 
  2005. +slotsize+wantsize
  2006. report(
  2007. mess("MenuMem"))
  2008. pollloop
  2009.  font$<>"" 
  2010. I*P   
  2011.  "Font_ListFonts",, menu, (7<<19), menubufsize, ind, menuindsize, font$
  2012. I>L   
  2013.  "Font_ListFonts",, menu, (7<<19), menubufsize, ind, menuindsize, 1
  2014. IR    =menu
  2015. decodefontmenu
  2016.  findfont$, pos, icon, std, territory, start, system, fonthandle
  2017. system=(block%!12=0)
  2018. block%!256=0
  2019.  "XFont_DecodeMenu", 0, Fontmenu%, block%+12, block%+256, 256
  2020. (findfont$=
  2021. readstring(block%+256, 0)
  2022.  findfont$="" 
  2023.  system 
  2024.    font$=""
  2025.    std=
  2026. findfont$, "\F")
  2027. "   territory=
  2028. findfont$, "\f")
  2029.  std+territory=0 
  2030. report(
  2031. mess("Font"), 0) : 
  2032.  territory>0 
  2033. -      start=
  2034. findfont$, " ", territory)+1
  2035.       start=std+2
  2036. J.$   pos=
  2037. findfont$, "\", start+1)
  2038. J8#   
  2039.  pos=0 
  2040.  pos=
  2041. (findfont$)+1
  2042. JB*   font$=
  2043. findfont$, start, pos-start)
  2044.  "Wimp_GetPointerInfo",,block%+128
  2045.  (block%!136 
  2046.  1) =1 
  2047. =Fontmenu%
  2048.    Fontmenu%=-1
  2049. !   Fontmenu%=
  2050. fontmenu(font$)
  2051. reopenmenu(currenthandle%, menux%, menuy%)
  2052.    currenthandle%=0
  2053. =Fontmenu%
  2054.    Fontmenu%=-1
  2055.  fonttype 
  2056.  Text
  2057. 7      
  2058. setfont(font$, "Trinity.Medium", texthandle)
  2059.       textfont$=font$
  2060.  Heading
  2061. 6      
  2062. setfont(font$, "Homerton.Bold", headhandle)
  2063.       headfont$=font$
  2064.  Greyed
  2065. K<>      
  2066. setfont(font$, "Trinity.Medium.Italic", greyhandle)
  2067.       greyfont$=font$
  2068. redrawwindows
  2069. setfont(
  2070.  font$, def$, 
  2071.  fonthandle)
  2072.  fonthandle<>-1 
  2073.  "Font_LoseFont", fonthandle
  2074.  font$<>"" 
  2075.  "XFont_FindFont",,font$, fontsize*16, fontsize*16, 0, 0 
  2076.  fonthandle;flags
  2077.  (flags 
  2078.  1)>0 
  2079. P      
  2080.  "XFont_FindFont",,def$, fontsize*16, fontsize*16, 0, 0 
  2081.  fonthandle
  2082.       font$=def$
  2083.  Mouse
  2084. icons
  2085.  *** Info box (win_info) ***
  2086. icon_version=7
  2087.  *** Module info box (win_modinfo) ***
  2088. icon_modname=4
  2089. icon_modver=5
  2090. icon_modspecial=6
  2091. icon_modstatus=7
  2092.  *** Help box (win_help) ***
  2093. icon_helptext=1
  2094. icon_cancel=2
  2095. icon_OK=3
  2096.  *** Command box (win_command) ***
  2097.  icon_cancel and icon_OK as win_help
  2098. icon_help=4
  2099. icon_value=5
  2100. icon_commandmain=7
  2101. icon_arg1=8
  2102. icon_arg2=9
  2103. icon_arg3=10
  2104. icon_arg4=11
  2105.  *** Mouse clicks box (win_mouseact) ***
  2106.  icon_cancel and icon_OK already defined
  2107. icon_iconbarclick=5
  2108. icon_winclick=13
  2109.  *** Save window (win_saveas) ***
  2110.  icon_cancel and icon_OK (well, icon_save really) already define
  2111. icon_saveicon=0
  2112. icon_savetext=1
  2113. click(type, button)
  2114.  comworks, match, mod, buffer, line, loop
  2115.  button+=_Shift
  2116.  button+=_Ctrl
  2117.  button+=_Alt
  2118. comworks=
  2119.  type=_ModWin 
  2120.  type=_Window : comworks=
  2121. match=-1
  2122.  loop=0 
  2123.  mouseclick(type, loop)=button 
  2124.  match=loop
  2125.  match<>-1 
  2126.  type 
  2127.       
  2128.  _Iconbar
  2129.          
  2130.  match 
  2131. N /            
  2132.  _IconMod  : 
  2133. openmodulewindow
  2134. N*-            
  2135.  _IconHelp : 
  2136. openhelpwindow
  2137. N40            
  2138.  _IconComm : 
  2139. opencommandwindow
  2140.          
  2141.       
  2142.  _Window
  2143.          
  2144.  comworks 
  2145. N\*            buffer=
  2146. bufwindow(window%)
  2147. Nf+            line=
  2148. winline(window%, my%)
  2149.             
  2150.  match 
  2151. Nz7               
  2152.  _WinHelp  : 
  2153. gethelp(buffer, line)
  2154. :               
  2155.  _WinComm  : 
  2156. getcommand(buffer, line)
  2157. 5               
  2158.  _WinSave  : 
  2159. savebox(window%, 
  2160. 6               
  2161.  _WinClose : 
  2162. removebuffer(buffer)
  2163.             
  2164.          
  2165. #            mod=prefsort?selmod
  2166.             
  2167.  match 
  2168. K               
  2169.  _WinHelp  : 
  2170.  (status?mod<3 
  2171.  status?mod>4) 
  2172. modhelp
  2173. :               
  2174.  _WinClose : 
  2175. closewindow(win_modules)
  2176.             
  2177.         
  2178. checkmouse(mx%, my%, button%, window%, icon%)
  2179.  buffer, mod, keyword$
  2180.  item, type
  2181.  button%=2 
  2182.  window% 
  2183. O~8      
  2184.  -2           : 
  2185. ploticonmenu(Iconmenu%, mx%)
  2186.       
  2187.  win_modules
  2188. #         selmod=
  2189. modnumber(my%)
  2190.          
  2191. buildmodulemenu
  2192. +         
  2193. plotmenu(Mainmenu%, mx%, my%)
  2194.       
  2195.          viewerwin=window%
  2196. -         viewerbuffer=
  2197. bufwindow(window%)
  2198. .         viewerline=
  2199. winline(window%, my%)
  2200. -         
  2201. plotmenu(Viewermenu%, mx%, my%)
  2202.  window% 
  2203.       
  2204. &         
  2205. click(_Iconbar, button%)
  2206.       
  2207.  win_modules
  2208. #         selmod=
  2209. modnumber(my%)
  2210. P(          mod=prefsort?selmod
  2211. P2%         
  2212. click(_ModWin, button%)
  2213.       
  2214.  win_help
  2215.          
  2216.  icon% 
  2217. PP6            
  2218.  icon_cancel : 
  2219. closewindow(win_help)
  2220.             
  2221.  icon_OK
  2222.                
  2223. helpcommand
  2224. Pn0               
  2225.  button%=1 
  2226. openhelpwindow
  2227.          
  2228.       
  2229.  win_command
  2230.          
  2231.  icon% 
  2232. 9            
  2233.  icon_cancel : 
  2234. closewindow(win_command)
  2235.             
  2236.  icon_OK
  2237.                
  2238. starcommand
  2239. 3               
  2240.  button%=1 
  2241. opencommandwindow
  2242. *            
  2243.  icon_help : 
  2244. commandhelp
  2245. )            
  2246.  icon_value : 
  2247. showvalue
  2248.          
  2249.       
  2250.  win_saveas
  2251.          
  2252.  icon% 
  2253. 8            
  2254.  icon_cancel : 
  2255. closewindow(win_saveas)
  2256. S            
  2257.  icon_saveicon : 
  2258. startdrag("file_fff", win_saveas, icon_saveicon)
  2259.          
  2260.       
  2261.  win_mouseact
  2262.          
  2263.  icon% 
  2264. Q":            
  2265.  icon_cancel : 
  2266. closewindow(win_mouseact)
  2267.             
  2268.  icon_OK
  2269. Q60               mouseclick()=tempmouseclick()
  2270. Q@&               
  2271.  button%=_Select 
  2272. QJ0                  
  2273. closewindow(win_mouseact)
  2274.                
  2275. Q^&                  
  2276. openmousewindow
  2277.                
  2278.             
  2279. Q|+               
  2280.  icon%>=icon_winclick 
  2281. "                  type=_Window
  2282. 2                  item=(icon%-icon_winclick)/2
  2283.                
  2284. #                  type=_Iconbar
  2285. 6                  item=(icon%-icon_iconbarclick)/2
  2286.                
  2287.                
  2288. %                  button%+=_Shift
  2289.                
  2290.                   
  2291. '                     button%+=_Ctrl
  2292.                   
  2293. .                     
  2294.  button%+=_Alt
  2295.                   
  2296.                
  2297. 6               
  2298. setmouseclick(type, item, button%)
  2299. R&1               
  2300. displaymouseclick(type, item)
  2301.          
  2302.       
  2303. RD%         
  2304. click(_Window, button%)
  2305. startdrag(spr$, win, icon)
  2306. !block%=win
  2307.  "Wimp_GetWindowState",,block%
  2308. block%!36=win
  2309. block%!40=icon
  2310.  "Wimp_GetIconState",,block%+36
  2311. block%!44+=block%!4
  2312. block%!48+=block%!16
  2313. block%!52+=block%!4
  2314. block%!56+=block%!16
  2315.  "DragASprite_Start", %10000000, 1, spr$, block%+44
  2316.  Wimp
  2317. startwimp
  2318. $block%="TASK"
  2319.  "Wimp_Initialise", 310, !block%, taskname$, messblock 
  2320.  version, TaskHandle
  2321.  SYS "Vigil_RegisterApplication", TaskHandle
  2322. WimpInit=
  2323. readstring(offset, end)
  2324. A%=offset
  2325. B%=string
  2326.  stringread
  2327. =$string
  2328. readwindowtitle(window%)
  2329. !block%=window%
  2330.  "Wimp_GetWindowInfo",,block%+1
  2331. readstring(block%!76, 0)
  2332. iconbar(spname$)
  2333.  width
  2334.  "Wimp_SpriteOp", 256+40,, spname$ 
  2335.  ,,,width
  2336. !block%=-1
  2337. block%!4=0
  2338. block%!8=0
  2339. block%!12=width+32
  2340. block%!16=96
  2341. block%!20=&2102
  2342.  block%!24 
  2343. (spname$)
  2344. $(block%!24)=spname$
  2345. block%!28=1
  2346. block%!32=(
  2347. spname$+1)
  2348.  "Wimp_CreateIcon",,block% 
  2349.  icon%
  2350. doneiconbar=
  2351. =icon%
  2352. writeicon(window%, icon%, string$)
  2353. !block%=window%
  2354. block%!4=icon%
  2355.  "Wimp_GetIconState",,block%
  2356.  (block%!24 
  2357.  1<<23)>1 
  2358. report(
  2359. mess("IcDel"))
  2360. $(block%!28)=string$
  2361.  "Wimp_ForceRedraw", !block%, block%!8, block%!12, block%!16, block%!20
  2362. readicon(window%, icon%)
  2363. !block%=window%
  2364. block%!4=icon%
  2365.  "Wimp_GetIconState",,block%
  2366.  (block%!24 
  2367.  1<<23)>1 
  2368. report("Read: "+
  2369. mess("Icdel")) : =""
  2370. =$(block%!28)
  2371. faint(window%, icon%, faint%)
  2372.  mask, set
  2373. mask=1<<22
  2374. set=(-faint%)<<22
  2375.  faint% 
  2376.  mask+=1<<21
  2377. seticonstate(window%, icon%, mask, set)
  2378. faint(window%, icon%)
  2379.  loop
  2380. !block%=window%
  2381. block%!4=icon%
  2382.  "Wimp_GetIconState",,block%
  2383. =((block%!24 
  2384.  1<<22)>0)
  2385. seticonstate(window%, icon%, mask, bits)
  2386. !block%=window%
  2387. block%!4=icon%
  2388. block%!8=bits
  2389. block%!12=mask
  2390.  "Wimp_SetIconState",,block%
  2391. msgtrans
  2392.  flags, buflength
  2393.  "MessageTrans_FileInfo", , alias$+".Messages" 
  2394.  flags, ,buflength
  2395.  (flags 
  2396.  1)=0 
  2397.  MsgBuffer buflength
  2398.  MsgDescript 20
  2399. [6M   
  2400.  "MessageTrans_OpenFile", MsgDescript, alias$+".Messages", MsgBuffer
  2401. [J<   
  2402. report("Hey, these messages are already in memory.")
  2403. mess(tok$)
  2404.  loop, in, out$, pointer, length
  2405.  in (
  2406. (tok$)+1)*2
  2407. $in=tok$+":"+tok$
  2408. ?(in+
  2409. ($in))=0
  2410.  "MessageTrans_Lookup", MsgDescript, in, 0, 0, 0, 0, 0, 0 
  2411.  ,,pointer,length
  2412.  loop=0 
  2413.  length-1
  2414.    out$+=
  2415. (pointer?loop)
  2416.     =out$
  2417. messarg(tok$, arg1$, arg2$, arg3$, arg4$)
  2418.  loop, in$, out$, buffer, pointer, length
  2419.  in (
  2420. (tok$)+1)*2, buffer 256
  2421. $in=tok$+":"+tok$
  2422. ?(in+
  2423. ($in))=0
  2424.  "MessageTrans_Lookup", MsgDescript, in, buffer, 256, arg1$, arg2$, arg3$, arg4$ 
  2425.  ,,pointer, length
  2426.  loop=0 
  2427.  length-1
  2428.    out$+=
  2429. (pointer?loop)
  2430. \X    =out$
  2431. setcaret(window, icon)
  2432.  "Wimp_SetCaretPosition", window, icon, -1, -1, -1, 
  2433. readicon(window, icon))
  2434. caseless(str$)
  2435. $string=str$
  2436. A%=string
  2437.  caseless
  2438. =$string
  2439.  WimpMenus
  2440. colourmenu(menu%, title$)
  2441.  colour, flags, offset
  2442. $menu%=title$
  2443. menu%!12=&70207
  2444. menu%!16=
  2445. (title$)*16+16
  2446. menu%!20=44
  2447. menu%!24=0
  2448.  colour=0 
  2449.     offset=menu%+28+colour*24
  2450.    !offset=0
  2451.  colour=15 
  2452.  !offset=&80
  2453.    offset!4=-1
  2454. ^.6   offset!8=&29+(textcol(colour)<<24)+(colour<<28)
  2455.    $(offset+12)=
  2456. (colour)
  2457. menu(title$, items, menu%)
  2458.  offset, width, loop
  2459.  char$, pos
  2460.  option$, item$
  2461.  place, length
  2462.  menupos, flags, icondata
  2463. width=0
  2464.  loop=1 
  2465.  items
  2466.    item$=menu$(loop-1)
  2467.  width<
  2468. (item$) 
  2469.  width=
  2470. (item$)
  2471.  width>30 
  2472.  width=30
  2473. (title$)>width 
  2474.  width=
  2475. (title$)
  2476. $menu%=title$
  2477. menu%!12=&70207
  2478. menu%!16=width*16+16
  2479. menu%!20=44
  2480. menu%!24=0
  2481. offset=28
  2482. menupos=0
  2483.    item$=menu$(menupos)
  2484.    pos=1
  2485.    char$=
  2486. char(item$, pos)
  2487.    option$=""
  2488.    flags=0
  2489.    icondata=&7000021
  2490. "/-|!:#", char$)
  2491.       
  2492.  char$ 
  2493. &         
  2494.  "/" : flags+=1 : 
  2495.  tick
  2496. 5         
  2497.  "-" : flags+=2 : 
  2498.  dotted line follows
  2499. 0         
  2500.  "|" : flags+=4 : 
  2501.  writeable item
  2502. 2         
  2503.  "!" : flags+=8 : 
  2504.  generate message
  2505. C         
  2506.  "#" : flags+=16 : 
  2507.  allow submenu even if greyed out
  2508. +         
  2509.  ":":icondata+=2^22 : 
  2510.  faint
  2511.       
  2512. !      char$=
  2513. char(item$, pos)
  2514.    menu%!offset=flags
  2515.     menu%!(offset+8)=icondata
  2516.  pos<=
  2517. (item$)+1
  2518.       option$+=char$
  2519. `,!      char$=
  2520. char(item$, pos)
  2521.    length=
  2522. (option$)
  2523. `J0   
  2524.  length>30 
  2525.  option$=
  2526. option$, 27)+"..."
  2527.  length>12 
  2528.       IndMenuPos+=1
  2529.       icondata+=2^8
  2530. `r#      menu%!(offset+8)=icondata
  2531. `|'      place=menubuf+(IndMenuPos*30)
  2532. "      !(menu%+offset+12)=place
  2533. '      !(menu%+offset+16)=validation
  2534. "      !(menu%+offset+20)=width
  2535.       ?(place+length)=0
  2536.       place=menu%+offset+12
  2537.    $place=option$
  2538. (   menu%!(offset+4)=submenu(menupos)
  2539.  menupos=items-1 
  2540.  menu%!offset+=2^7
  2541.    offset+=24
  2542.    menupos+=1
  2543.  menupos=items
  2544.  menu%=Iconmenu% 
  2545.  menuheight%=items*44+96
  2546. char(string$, 
  2547.  pos)
  2548. pos+=1
  2549. string$, pos-1, 1)
  2550. plotmenu(menuhandle%, menux%, menuy%)
  2551. currenthandle%=menuhandle%
  2552.  "Wimp_CreateMenu",,currenthandle%, menux%-64, menuy%
  2553. reopenmenu(menuhandle%, menux%, menuy%)
  2554.  "Wimp_CreateMenu",,currenthandle%, menux%-64, menuy%
  2555. currenthandle%=menuhandle%
  2556. ploticonmenu(menuhandle%, menux%)
  2557. currenthandle%=menuhandle%
  2558.  "Wimp_CreateMenu",,currenthandle%, menux%-64, menuheight%
  2559. openmenudbox(window)
  2560.  "Wimp_GetPointerInfo",,block%
  2561.  "Wimp_CreateMenu",,window, !block%-64, block%!4
  2562. menuselect
  2563.  "Wimp_GetPointerInfo",,block%+128
  2564. but%=block%!136
  2565. decodemenu(block%)
  2566. dofunctions
  2567. decodemenu(read)
  2568.  address, itemstart, offset, menu, newmenu
  2569. ct,menunumber%=
  2570. handletonum(currenthandle%)
  2571.    address=!read
  2572. +   menunumber%=(menunumber%*10)+address
  2573.    read+=4
  2574.  !read=-1
  2575. (menunumber%=(menunumber%-address)/10
  2576. item%=address
  2577. faintmenu(menuhandle%, menuitem%, faint%)
  2578.  val, bit22
  2579. 'val=menuhandle%!(24*(menuitem%)+36)
  2580. bit22=((val 
  2581.  2^22)>0)
  2582.  bit22 
  2583.  val-=2^22
  2584.  faint% 
  2585.  val+=2^22
  2586. d('menuhandle%!(24*(menuitem%)+36)=val
  2587. tickmenu(menuhandle%, menuitem%, tick%)
  2588.  val, bitset
  2589. dn'val=menuhandle%!(24*(menuitem%)+28)
  2590. bitset=((val 
  2591.  1)>0)
  2592.  bitset 
  2593.  val-=1
  2594.  tick% 
  2595.  val+=1
  2596. 'menuhandle%!(24*(menuitem%)+28)=val
  2597.  WimpMess
  2598. messageinit
  2599.  messblock 256
  2600.  palette 80, colourtrans 256
  2601.  input 20, output 20
  2602. pos=-4
  2603.    pos+=4
  2604.  messblock!pos
  2605.  messblock!pos=0
  2606.  2, 10, &502, &400C0, &400C1, &400C9, 0
  2607. message(reason%)
  2608.  actioncode, num, address
  2609. originhandle=block%!4
  2610. actioncode=block%!16
  2611.  actioncode 
  2612.  0 : 
  2613. finish
  2614.  2 : 
  2615. saveack
  2616.  10 : 
  2617. savedesktop
  2618.  &502 : 
  2619.  &400C0 : 
  2620. opensubmenu
  2621.  &400C1 : 
  2622. getmodevars
  2623.  &400C9
  2624.       
  2625.  Fontmenu%<>-1 
  2626.          
  2627. =Fontmenu%
  2628.          Fontmenu%=-1
  2629.       
  2630. opensubmenu
  2631.  submenu, x, y
  2632. submenu=block%!20
  2633. x=block%!24
  2634. y=block%!28
  2635.  submenu 
  2636. fv%   
  2637.  win_modinfo : 
  2638. fillinmodinfo
  2639.  win_saveas
  2640.        
  2641. savebox(viewerwin, 
  2642.       submenu=win_saveas
  2643.  Greyedmenu%
  2644.       
  2645. newfonttype(Greyed)
  2646. (      Fontmenu%=
  2647. fontmenu(greyfont$)
  2648.       submenu=Fontmenu%
  2649.  Normalmenu%
  2650.       
  2651. newfonttype(Text)
  2652. (      Fontmenu%=
  2653. fontmenu(textfont$)
  2654.       submenu=Fontmenu%
  2655.  Headingmenu%
  2656.       
  2657. newfonttype(Heading)
  2658. g (      Fontmenu%=
  2659. fontmenu(headfont$)
  2660.       submenu=Fontmenu%
  2661.       submenu=Fontmenu%
  2662.  "Wimp_CreateSubMenu", , submenu, x, y
  2663. submenux=x
  2664. submenuy=y
  2665. newfonttype(type)
  2666.  fonttype<>type 
  2667.    fonttype=type
  2668. =Fontmenu%
  2669.    Fontmenu%=-1
  2670. getmodevars
  2671.  input, output
  2672.  input 24, output 24
  2673. 6!input=130: 
  2674.  Right-hand column of graphics window
  2675. .input!4=131 : 
  2676.  Top row of graphics window
  2677. =input!8=4 : 
  2678.  XEigFactor, shift pixels to obtain OS units
  2679. input!12=5 : 
  2680.  YEigFactor
  2681. input!16=9 : 
  2682.  Log2BPP
  2683. input!20=-1
  2684.  26 : 
  2685.  Reset window just in case
  2686.  "OS_ReadVduVariables", input, output
  2687. XEigFactor=output!8
  2688. YEigFactor=output!12
  2689. BPP=(1<<output!16)/8
  2690. ht!MaxXCoord=!output<<XEigFactor
  2691. h~"MaxYCoord=output!4<<YEigFactor
  2692.  "ColourTrans_SelectTable", 12, palette, -1, -1, colourtrans
  2693.  window, icon
  2694.  mess$, text$
  2695.  addicon, style$
  2696.  faint, mod, ver$
  2697. window=block%!32
  2698. icon=block%!36
  2699. text$="" : mess$=""
  2700. block%+=128
  2701.  "Wimp_GetPointerInfo",,block%
  2702. &faint=
  2703. faint(block%!12, block%!16)
  2704. addicon=
  2705.  window 
  2706.  win_info : mess$="HI"
  2707. iF#   
  2708.  win_modinfo : mess$="H2MI"
  2709.  win_help : mess$="HH"
  2710. iZ!   
  2711.  win_command : mess$="HC"
  2712. id#   
  2713.  win_mouseact : mess$="HAM"
  2714. in!   
  2715.  win_saveas : mess$="HSA"
  2716. ix'   
  2717.  -2 : mess$="HIcon" : addicon=
  2718.  win_modules:
  2719.       addicon=
  2720. 3      mod=prefsort?
  2721. modnumber(!(block%-128+24))
  2722.       ver$=ver$(mod)
  2723. 3      
  2724.  spec$(mod)<>"" 
  2725.  ver$+=" 
  2726.  "+spec$(mod)
  2727. V      text$=
  2728. messarg("HModW", mod$(mod), name$(mod), ver$, modstatus$(status?mod))
  2729. 9      
  2730.  "Wimp_GetMenuState", 1, block%, window, icon
  2731.       
  2732.  !block%<>-1 
  2733.           
  2734. decodemenu(block%)
  2735. /         mess$="HM"+
  2736. (menunumber%)+
  2737. (item%)
  2738. !         
  2739.  faint 
  2740.  mess$+="G"
  2741.          addicon=
  2742.       
  2743.          mess$="HO"
  2744.       
  2745. block%-=128
  2746.  addicon 
  2747.  icon 
  2748.       
  2749.  -1 : mess$+="W"
  2750.       
  2751.  : mess$+=
  2752. (icon)
  2753. block%!16=&503
  2754.  text$="" 
  2755.  mess$<>"" 
  2756.  text$=
  2757. mess(mess$) 
  2758.  text$=""
  2759. $(block%+20)=text$
  2760. ?(block%+20+
  2761. (text$))=0
  2762. !block%=24+(
  2763. (text$) 
  2764.  4)*4
  2765. block%!12=block%!8
  2766.  "Wimp_SendMessage", 17, block%, block%!4
  2767. savedesktop
  2768.  handle
  2769. handle=block%!20
  2770. #handle, StartCLIGuard$
  2771. dragged
  2772.  window, icon, save$
  2773.  "Wimp_GetPointerInfo",,block%
  2774. window=block%!12
  2775. icon=block%!16
  2776. .save$=
  2777. readicon(win_saveas, icon_savetext)
  2778. block%!20=window
  2779. block%!24=icon
  2780. block%!28=!block%
  2781. block%!32=block%!4
  2782. Iblock%!36=textbuffer(savebuffer, _End)-textbuffer(savebuffer, _Start)
  2783. block%!40=&FFF
  2784. $(block%+44)=save$+
  2785. #!block%=44+(
  2786. (save$)+4) 
  2787. block%!12=0
  2788. block%!16=1
  2789.  "Wimp_SendMessage", 17, block%, window, icon
  2790. saveack
  2791.  file$, filetype, info, file, maxline, line
  2792. filetype=block%!40
  2793. l4#file$=
  2794. readstring(block%+44, 0)
  2795. l>&info=textbuffer(savebuffer, _Info)
  2796. maxline=!info
  2797. file=
  2798. (file$)
  2799. pointer=info+8
  2800.  line=0 
  2801.  maxline
  2802. #file, $(!pointer)
  2803.    pointer+=4
  2804. #file
  2805. ("SetType "+file$+" &"+
  2806. ~(filetype))
  2807. block%!12=block%!8
  2808. block%!16=3
  2809.  "Wimp_SendMessage", 17, block%, block%!4
  2810.  Windows
  2811. loadtemplates(file$)
  2812.  loop, winpos, win, ind, slotsize, templates, free
  2813.  "Wimp_OpenTemplate",,file$
  2814.  "Wimp_SlotSize", -1, -1 
  2815.  slotsize, , free
  2816.  free<>0 
  2817.    templates=
  2818.    winsize=free
  2819. +slotsize+free
  2820.    templates=0
  2821. mV win_info=
  2822. loadwindow("info")
  2823. m`&win_modinfo=
  2824. loadwindow("modinfo")
  2825. mj&win_modules=
  2826. loadwindow("modules")
  2827. mt win_help=
  2828. loadwindow("help")
  2829. m~&win_command=
  2830. loadwindow("command")
  2831. (win_mouseact=
  2832. loadwindow("mouseact")
  2833. $win_saveas=
  2834. loadwindow("saveas")
  2835.  templates<>0 
  2836. =templates
  2837.  "Wimp_LoadTemplate",,-1,,,, "modhelp", 0 
  2838.  ,modhelpwinsize,indsize
  2839.  modhelpwin modhelpwinsize
  2840.  ind indsize
  2841.  "Wimp_LoadTemplate",,modhelpwin, ind, ind+indsize, -1, "modhelp",0
  2842.  "Wimp_CloseTemplate"
  2843. loadwindow(win$)
  2844.  win, bufsize, indsize, buffer, ind
  2845.  "Wimp_LoadTemplate",,-1,,,, win$, 0 
  2846.  ,bufsize, indsize
  2847.  templates=0 
  2848.  buffer bufsize
  2849.    buffer=templates
  2850.  ind indsize
  2851.  "Wimp_LoadTemplate",,buffer, ind, ind+indsize, -1, win$, 0
  2852.  "Wimp_CreateWindow",,buffer 
  2853. openwindow(window%)
  2854. !block%=window%
  2855.  "Wimp_GetWindowState",,block%
  2856.  "Wimp_OpenWindow",,block%
  2857. closewindow(window%)
  2858. !block%=window%
  2859. close
  2860. close
  2861.  buffer, loop
  2862.  "Wimp_CloseWindow",,block%
  2863.  !block%=win_modules 
  2864.  winopen_modules=
  2865. buffer=-1
  2866.  loop=1 
  2867.  bufferwindows
  2868.  !block%=textbuffer(loop, _Handle) 
  2869.  buffer=loop
  2870.  buffer<>-1 
  2871. removebuffer(buffer)
  2872. forceredraw(window%)
  2873. !block%=window%
  2874.  "XWimp_GetWindowState",,block%
  2875.  "XWimp_ForceRedraw", -1, block%!4, block%!8, block%!12, block%!16
  2876. redraw
  2877.  more
  2878.  worky0, worky1
  2879.  first, last
  2880.  line, x, y, maxy, mod
  2881.  maxline, buffer, info, pointer, text
  2882.  printcolour
  2883. buffer=-1
  2884. printcolour=textcolour
  2885.  !block%=win_modules 
  2886.    maxline=nummodules-1
  2887.    buffer=0
  2888. !   buffer=
  2889. bufwindow(!block%)
  2890.  buffer=-1 
  2891. L      
  2892. report("What the hell is this window someone told me to redraw?")
  2893. (      info=textbuffer(buffer, _Info)
  2894.       maxline=!info
  2895.  "Wimp_RedrawWindow",,block% 
  2896.  more
  2897.  more
  2898.  "Wimp_SetColour", textcolour
  2899.  buffer>=0 
  2900. q $      maxy=(block%!16-block%!24)
  2901.       worky0=block%!32-maxy
  2902.       worky1=block%!40-maxy
  2903.       first=
  2904. (-worky1/32)
  2905. qH!      last=
  2906. (-worky0/32+1.50)
  2907. qR)      
  2908.  first>maxline 
  2909.  first=maxline
  2910. q\'      
  2911.  last>maxline 
  2912.  last=maxline
  2913. qf       x=block%!4+4-block%!20
  2914.       
  2915.  buffer=0 
  2916. qz          
  2917.  line=first 
  2918.  last
  2919.              y=maxy-8-line*32
  2920. %            mod=prefsort?(line+1)
  2921. F            
  2922.  status?mod=3 
  2923.  status?mod=4 
  2924.  printcolour=greycolour
  2925. c            
  2926.  showname=Short 
  2927. print(mod$(mod), x, y) 
  2928. print(name$(prefsort?(line+1)), x, y)
  2929. =            
  2930.  showver 
  2931. print(ver$(mod), x+vertab*16, y)
  2932. P            
  2933.  showstatus 
  2934. print(modstatus$(status?mod), x+statustab*16, y)
  2935. @            
  2936.  showspec 
  2937. print(spec$(mod), x+spectab*16, y)
  2938. F            
  2939.  status?mod=3 
  2940.  status?mod=4 
  2941.  printcolour=textcolour
  2942.          
  2943.       
  2944. #         pointer=info+8+first*4
  2945.           
  2946.  line=first 
  2947.  last
  2948.             text=!pointer
  2949.             
  2950.  !text=arrow 
  2951. )               printcolour=headcolour
  2952. 7               
  2953. print($(text+4), x, maxy-8-line*32)
  2954. r$)               printcolour=textcolour
  2955.             
  2956. r83               
  2957. print($text, x, maxy-8-line*32)
  2958.             
  2959.             pointer+=4
  2960.          
  2961.       
  2962. rt,   
  2963.  "Wimp_GetRectangle",,block% 
  2964.  more
  2965. print(text$, x, y)
  2966.  fonthandle
  2967. fonthandle=-1
  2968.  printcolour 
  2969.  textcolour : fonthandle=texthandle
  2970.  greycolour : fonthandle=greyhandle
  2971.  headcolour : fonthandle=headhandle
  2972.  fonthandle=-1 
  2973.  x, y
  2974.  printcolour<>textcolour 
  2975. *      
  2976.  "Wimp_SetColour", printcolour
  2977.       
  2978.  text$
  2979. s2)      
  2980.  "Wimp_SetColour", textcolour
  2981.       
  2982.  text$
  2983. sd$   
  2984.  "Font_SetFont", fonthandle
  2985. seD   
  2986.  "ColourTrans_SetFontColours", fonthandle, &FFFFFF00, 0, 14
  2987. snA   
  2988.  "Font_Paint", fonthandle, text$, (1<<4)+(1<<9), x, y-24
  2989.